import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false

//1.引入vue 和vue-router
import Router from "vue-router"
Vue.use(Router)

//2.定义路由出口
//<router-view></router-view>

//3.引入组件
import login from "./pages/login.vue"
import home from "./pages/home.vue"
import register from "./pages/register.vue"

new Vue({
  render: h => h(App),
//4.定义路由规则,创建一个路由对象
  router:new Router({
    //必须是routes
    routes:[
      {
        path:"/login",
        component:login
      },
      {
        path:"/home",
        component:home
      },
      {
        path:"/register",
        component:register
      },
      //重定向
      {
        path:"*",
        component:home
      }
    ]
  })
}).$mount('#app')
